package org.jetlinks.pro.tenant.supports;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.jetlinks.pro.assets.AssetBinding;
import org.jetlinks.pro.assets.AssetType;
import org.jetlinks.pro.tenant.TenantAsset;
import org.jetlinks.pro.tenant.dimension.TenantDimensionType;

@Getter
@Setter
@AllArgsConstructor(staticName = "of")
@NoArgsConstructor
public class DefaultTenantAsset implements TenantAsset {

    private String tenantId;

    private String assetId;

    private AssetType assetType;

    private String ownerId;

    private long permissionValue;

    private TenantDimensionType targetType;

    public static DefaultTenantAsset of(String tenantId, String assetId, AssetType assetType, String ownerId, long permissionValue) {
        return new DefaultTenantAsset(tenantId, assetId, assetType, ownerId, permissionValue,TenantDimensionType.tenantMember);
    }

    public static DefaultTenantAsset of(TenantAsset asset,TenantDimensionType dimensionType){
        return of(asset.getTenantId(),asset.getAssetId(),asset.getAssetType(),asset.getOwnerId(),asset.getPermissionValue(),dimensionType);
    }
}
